1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
use crate::value::{Linearity, Relationship, Dependency, Usage};
use failure_derive::Fail;
#[derive(Debug, Copy, Clone, Fail, Eq, PartialEq, Hash)]
pub enum Error {
#[fail(display = "Undefined symbol")]
UndefinedSymbol,
#[fail(display = "Identifier does not refer to a symbol")]
NotASymbol,
#[fail(display = "Value is not a type")]
NotAType,
#[fail(display = "Value is not an instant")]
NotAnInstant,
#[fail(display = "Value is not a function")]
NotAFunction,
#[fail(display = "Value is not a function type")]
NotAFunctionType,
#[fail(display = "Malformed parameter declaration")]
MalformedParam,
#[fail(display = "Type mismatch")]
TypeMismatch,
#[fail(display = "Variance needs to be covariant")]
NeedsCovar,
#[fail(display = "Variance needs to be contravariant")]
NeedsContravar,
#[fail(display = "Universe level mismatch")]
UniverseLevelMismatch,
#[fail(display = "Unexpected contradictory constraint-set")]
Contradiction,
#[fail(display = "Instant order cycle")]
Cycle,
#[fail(display = "An affine value is used twice, i.e. a double-use error")]
DoubleUse(Usage, Usage),
#[fail(display = "Incompatible type linearities {:?} and {:?}", 0, 1)]
IncompatibleTypeLinearity(Linearity, Linearity),
#[fail(display = "Incompatible call usages {:?} and {:?}", 0, 1)]
IncompatibleCallUsage(Usage, Usage),
#[fail(display = "Type linearity too weak: !({:?} <= {:?})", 0, 1)]
TypeLinearityTooWeak(Linearity, Usage),
#[fail(display = "Incompatible linearities {:?}", 0)]
IncompatibleLinearity(Option<(Linearity, Linearity)>),
#[fail(display = "Wrong linearity ordering")]
WrongLinearityOrder,
#[fail(display = "Incompatible symbol dependencies {:?} and {:?}", 0, 1)]
IncompatibleDependencies(Dependency, Dependency),
#[fail(display = "Incompatible relationships {:?} and {:?}", 0, 1)]
IncompatibleRelationships(Relationship, Relationship),
#[fail(display = "{}", 0)]
Message(&'static str),
}